Skip to content

Conversation

@sbaldu
Copy link
Collaborator

@sbaldu sbaldu commented May 2, 2024

No description provided.

@sbaldu sbaldu force-pushed the feature_general_dijkstra branch from caf57ea to f37d1ea Compare May 2, 2024 10:00
@Grufoony
Copy link
Collaborator

Grufoony commented May 2, 2024

Please @sbaldu remember to update the project version

@sbaldu sbaldu requested a review from Grufoony May 10, 2024 17:16
@codecov
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.48%. Comparing base (93efdf4) to head (b799023).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #174   +/-   ##
=======================================
  Coverage   94.47%   94.48%           
=======================================
  Files          17       18    +1     
  Lines        2897     2900    +3     
  Branches      281      281           
=======================================
+ Hits         2737     2740    +3     
  Misses        160      160           
Flag Coverage Δ
unittests 94.48% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

double streetTime(const Graph* graph, Id node1, Id node2) {
const auto street{graph->street(node1, node2)};
const auto length{(*street)->length()};
const auto speed{(*street)->maxSpeed() *

Check warning

Code scanning / Cppcheck (reported by Codacy)

Local variable 'speed' shadows outer function Warning

Local variable 'speed' shadows outer function
addStreets(std::forward<Tn>(streets)...);
}

template <typename Func>

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
}

template <typename Func>
requires(std::is_same_v<std::invoke_result_t<Func, const Graph*, Id, Id>, double>)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
std::optional<DijkstraResult> Graph::shortestPath(const Node& source,
const Node& destination,
Func f) const {
return this->shortestPath(source.id(), destination.id());

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
return this->shortestPath(source.id(), destination.id());
}

template <typename Func>

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
while (unvisitedNodes.size() != 0) {
source = *std::min_element(unvisitedNodes.begin(),
unvisitedNodes.end(),
[&dist](const auto& a, const auto& b) -> bool {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
source = *std::min_element(unvisitedNodes.begin(),
unvisitedNodes.end(),
[&dist](const auto& a, const auto& b) -> bool {
return dist[a].second < dist[b].second;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
}
double streetWeight = getStreetWeight(this, source, neighbour.first);
// if current path is shorter than the previous one, update the distance
if (streetWeight + dist[source].second < dist[neighbour.first].second) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
while (true) {
previous = prev[previous].first;
if (previous == std::numeric_limits<Id>::max()) {
return std::nullopt;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
}

std::reverse(path.begin(), path.end());
return DijkstraResult(path, prev[destination].second);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.5 rule Note

MISRA 15.5 rule
dist[source] = std::make_pair(source, 0.);

std::vector<std::pair<Id, double>> prev(n_nodes);
std::for_each(prev.begin(), prev.end(), [](auto& pair) -> void {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
@Grufoony Grufoony merged commit 49adbae into main Dec 6, 2024
25 checks passed
@Grufoony Grufoony deleted the feature_general_dijkstra branch December 6, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants